//
//  TopList.m
//  DolphinMusic
//
//  Created by dllo on 15/3/25.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "TopList.h"

@implementation TopList

- (void)dealloc
{
    [_name release];
    [_type release];
    [_pic_s192 release];
    [_songArr release];
    [super dealloc];
}

- (instancetype)initWithDictionary:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"content"]) {
        self.songArr = [NSMutableArray array];
        if ([value isKindOfClass:[NSArray class]]) {
        for (NSDictionary *dic1 in value) {
            Song *song = [[Song alloc] initWithDictionary:dic1];
            [self.songArr addObject:song];
            [song release];
        }
        }
        else {
            for (NSInteger i = 0; i < 3; i++) {
                Song *song = [[Song alloc] init];
                [self.songArr addObject:song];
                [song release];
            }
        }
    }
}

- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}

@end
